package org.qiyu.live.im.provider.service.Impl;

import jakarta.annotation.Resource;
import org.qiyu.live.im.core.server.interfaces.constants.ImCoreServicerConstants;
import org.qiyu.live.im.provider.service.ImOnlineServicer;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @Description: //todo
 * @Author: 张广焱
 * @Date: 2023-12-10 22:30
 */
@Service
public class ImOnlineServicerImpl implements ImOnlineServicer {
    @Resource
    private RedisTemplate<String,Object>redisTemplate;
    @Override
    public boolean isOnline(long userId, int appId) {

        return Boolean.TRUE.equals(redisTemplate.hasKey(ImCoreServicerConstants.IM_BIND_IP_KEY + appId + ":" + userId));
    }
}
